package cn.tedu.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;


public class ConstructorTests {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        //1.获取Class对象
        Class<?> clazz = Point.class;
        //2.获取构造方法对象
        Constructor<?> declaredConstructor = clazz.getDeclaredConstructor();
        //3.通过构造方法对象构建类的实例
        Point point1 =(Point) declaredConstructor.newInstance();

        Point point2=ObjectFactory.newInstance(Point.class);

    }
}
